import request from '../utils/request'

//操作日志
export function handleLogList(data) {
  return request({
    url: '/produce/handle_log_list',
    method: 'post',
    data
  })
}

//任务删除
export function missionDel(data) {
  return request({
    url: '/produce/mission_del',
    method: 'post',
    data
  })
}

//工单生产任务从模版中添加
export function fromModel(data) {
  return request({
    url: '/produce/from_model',
    method: 'post',
    data
  })
}

//工单-产品单位
export function unitOther(data) {
  return request({
    url: '/base/unit_other',
    method: 'post',
    data
  })
}

//任务修改
export function missionEdit(data) {
  return request({
    url: '/produce/mission_edit',
    method: 'post',
    data
  })
}

//任务详情
export function missionDetail(data) {
  return request({
    url: '/produce/mission_detail',
    method: 'post',
    data
  })
}

//任务导出
export function missionExport(data) {
  return request({
    responseType: 'blob',
    url: '/produce/mission_export',
    method: 'get',
    params:data
  })
}

//任务列表
export function missionList(data) {
  return request({
    url: '/produce/mission_list',
    method: 'post',
    data
  })
}

//报工获取不良品项
export function reportBadProduct(data) {
  return request({
    url: '/produce/report_bad_product',
    method: 'post',
    data
  })
}

//报工详情
export function reportDetail(data) {
  return request({
    url: '/produce/report_detail',
    method: 'post',
    data
  })
}

//报工生产人员
export function reportProduceUser(data) {
  return request({
    url: '/produce/report_produce_user',
    method: 'post',
    data
  })
}

//工单删除/撤回
export function workOrderDel(data) {
  return request({
    url: '/produce/work_order_del',
    method: 'post',
    data
  })
}

//工单导出
export function workOrderExport(data) {
  return request({
    responseType: 'blob',
    url: '/produce/work_order_export',
    method: 'get',
    params:data
  })
}

//工单流转卡打印
export function workOrderPrint(data) {
  return request({
    responseType: 'blob',
    url: '/produce/workOrderPrint',
    method: 'get',
    params:data
  })
}

//工单二维码
export function workOrderQr(data) {
  return request({
    responseType: 'blob',
    url: '/produce/workOrderQr',
    method: 'get',
    params:data
  })
}

//工单列表打印
export function workOrderListPrint(data) {
  return request({
    responseType: 'blob',
    url: '/produce/workOrderList',
    method: 'get',
    params:data
  })
}

//工单操作
export function workOrderHandle(data) {
  return request({
    url: '/produce/work_order_handle',
    method: 'post',
    data
  })
}

//工单详情
export function woDetail(data) {
  return request({
    url: '/produce/wo_detail',
    method: 'post',
    data
  })
}

//工单导入
export function workOrderImport(data) {
  return request({
    url: '/produce/work_order_import',
    method: 'post',
    data
  })
}

//工单列表
export function workOrderList(data) {
  return request({
    url: '/produce/work_order_list',
    method: 'post',
    data
  })
}

//报工添加获取生产人员
export function workReportAddGet(data) {
  return request({
    url: '/produce/work_report_add_get',
    method: 'post',
    data
  })
}

//报工导出
export function workReportExport(data) {
  return request({
    responseType: 'blob',
    url: '/produce/work_report_export',
    method: 'get',
    params:data
  })
}

//报工操作
export function workReportHandle(data) {
  return request({
    url: '/produce/work_report_handle',
    method: 'post',
    data
  })
}

//报工列表
export function workReportList(data) {
  return request({
    url: '/produce/work_report_list',
    method: 'post',
    data
  })
}

//报工创建内工单编号下拉框
export function wrWorkOrder(data) {
  return request({
    url: '/produce/wr_work_order',
    method: 'post',
    data
  })
}

//报工创建内工序下拉框 参数传code 工单code
export function wrProcess(data) {
  return request({
    url: '/produce/wr_process',
    method: 'post',
    data
  })
}

//工单批量操作
export function wosHandle(data) {
  return request({
    url: '/produce/wos_handle',
    method: 'post',
    data
  })
}

//报工删除
export function workReportDel(data) {
  return request({
    url: '/produce/work_report_del',
    method: 'post',
    data
  })
}

//批量审批
export function updateState(data) {
  return request({
    url: '/produce/updateState',
    method: 'post',
    data
  })
}

//批量刷新绩效
export function flashPerformance(data) {
  return request({
    url: '/produce/flashPerformance',
    method: 'post',
    data
  })
}

//分配列表下拉数据
// export function distributionListData(data) {
//   return request({
//     url: '/produce/distributionListData',
//     method: 'get',
//     params:data
//   })
// }
export function distributionListData(data) {
  return request({
    url: '/produce/distributionListData',
    method: 'post',
    data
  })
}

//新增单位
export function unitHandle(data) {
  return request({
      url: '/base/unit_handle',
      method: 'post',
      data
  })
}

//工资绩效匹配
export function wageMatch(data) {
  return request({
      url: '/base/wage_match_test',
      method: 'post',
      data
  })
}

//筛选方案列表
export function screenPlanList(data) {
  return request({
      url: '/produce/screen_plan_list',
      method: 'post',
      data
  })
}

//筛选方案添加--编辑
export function screenPlanHandle(data) {
  return request({
      url: '/base/screen_plan_handle',
      method: 'post',
      data
  })
}

//筛选方案删除
export function spDel(data) {
  return request({
      url: '/base/sp_del',
      method: 'post',
      data
  })
}

// 任务--分配列表
export function userListByProcessId(data) {
  return request({
    url: '/user/userListByProcessId',
    method: 'post',
    data
  })
}

// 销售订单--生产计划--装备工单列表
export function formList(data) {
  return request({
    url: '/produce/form_list',
    method: 'post',
    data
  })
}

// 自定义表单删除
export function formDel(data) {
  return request({
    url: '/produce/form_del',
    method: 'post',
    data
  })
}

// 自定义字段公式计算
export function calc(data) {
  return request({
    url: '/base/calc',
    method: 'post',
    data
  })
}

// 表单内添加产品列表
export function formProduct(data) {
  return request({
    url: '/produce/form_product',
    method: 'post',
    data
  })
}

// 创建销售订单
export function editSalesOrder(data) {
  return request({
    url: '/produce/editSalesOrder',
    method: 'post',
    data
  })
}

// 销售订单详情
export function formDetail(data) {
  return request({
    url: '/produce/form_detail',
    method: 'post',
    data
  })
}

// 编辑打印模板列表
export function printTemplate(data) {
  return request({
    url: '/printTemplate/list',
    method: 'post',
    data
  })
}

// 删除打印模板
export function deleteTemplate(id) {
  return request({
    url: `/printTemplate/delete/${id}`,
    method: 'post'
  })
}

//上传打印模板
export function uploadTemplate(data) {
  const formData = new FormData();
  formData.append('file', data.file.raw);
  return request({
      url: '/printTemplate/uploadTemplate',
      method: 'post',
      headers: {
          'Content-Type': 'multipart/form-data',
      },
      data: formData
  })
}

//下载模板
export function downloadTemplate(data) {
  return request({
    responseType: 'blob',
    url: '/printTemplate/downloadTemplate',
    method: 'get',
    params:data
  })
}

//获取模块字段下拉
export function columnDropDown(module) {
  return request({
    url: `/cardConf/columnDropDown/${module}`,
    method: 'post',
  })
}

//卡片保存
export function cardSetEdit(data) {
  return request({
    url: '/cardConf/edit',
    method: 'post',
    data
  })
}

//卡片详情
export function cardSetDetail(data) {
  return request({
    url: '/cardConf/detail',
    method: 'post',
    data
  })
}

//任务批量修改自定义字段
export function batchModify(data) {
  return request({
    url: '/produce/edit_custom_fields',
    method: 'post',
    data
  })
}

//修改权限信息
export function updatePermission(data) {
  return request({
    url: '/user/updatePermission',
    method: 'post',
    data
  })
}

//修改加急信息
export function urgent(data) {
  return request({
    url: '/produce/urgent',
    method: 'post',
    data
  })
}

//查询条件缓存取出
export function getSearchCache(data) {
  return request({
    url: '/base/getSearchCache',
    method: 'post',
    data
  })
}

//查询条件缓存存储
export function setSearchCache(data) {
  return request({
    url: '/base/setSearchCache',
    method: 'post',
    data
  })
}
